package com.licoba.emoji.application;

import android.app.Application;
import android.content.Context;

import com.mob.MobSDK;

import cn.bmob.v3.Bmob;
import me.yokeyword.fragmentation.BuildConfig;
import me.yokeyword.fragmentation.Fragmentation;
import me.yokeyword.fragmentation.helper.ExceptionHandler;

public class MyApplication extends Application {
    private static MyApplication instance;
    private static Context appContext;

    @Override
    public void onCreate() {
        super.onCreate();


        instance = this;
        appContext = this;
        Bmob.initialize(getApplicationContext(),"49b3d70b4329df7b0c02299b32bd319a");
        //        MobSDK.init(this); //初始化ShareSDK
        // 通过代码注册你的AppKey和AppSecret
        MobSDK.init(getApplicationContext(), "282b9a6d1409b", "41706a8097e313fa1e67ad9651cc66b8");


        //初始化Fragmention
        Fragmentation.builder()
                // 设置 栈视图 模式为 （默认BUBBLE）悬浮球模式   SHAKE: 摇一摇唤出  NONE：隐藏， 仅在Debug环境生效
                .stackViewMode(Fragmentation.SHAKE)
                .debug(true) // 实际场景建议.debug(BuildConfig.DEBUG)
                /**
                 * 可以获取到{@link me.yokeyword.fragmentation.exception.AfterSaveStateTransactionWarning}
                 * 在遇到After onSaveInstanceState时，不会抛出异常，会回调到下面的ExceptionHandler
                 */
                .handleException(new ExceptionHandler() {
                    @Override
                    public void onException(Exception e) {
                        // 以Bugtags为例子: 把捕获到的 Exception 传到 Bugtags 后台。
                        // Bugtags.sendException(e);
                    }
                })
                .install();

    }

    public static MyApplication getInstance(){
        return instance;
    }
    public static Context  getContext(){
        return appContext;
    }



}
